package org.eliza.server.routex

import io.ktor.server.application.*
import io.ktor.server.routing.*
import kotlinx.rpc.krpc.ktor.server.Krpc
import kotlinx.rpc.krpc.ktor.server.rpc
import kotlinx.rpc.krpc.serialization.json.json
import rpc.SampleService
import rpc.SampleServiceImpl

fun Application.configureFrameworks() {
    install(Krpc)

    routing {
        rpc("/api") {
            rpcConfig {
                serialization {
                    json()
                }
            }

            registerService<SampleService> { ctx -> SampleServiceImpl(ctx) }
        }
    }
}
